﻿using System;
using Cysharp.Threading.Tasks;
using YooAsset;


namespace UniFramework.Asset
{
	public class OfflineAssetSystem : BaseAssetSystem
	{
		public override async UniTask Init(string defaultPackageName, Action initFinishCallBack)
		{
			await base.Init(defaultPackageName, initFinishCallBack);
			var buildinFileSystem = FileSystemParameters.CreateDefaultBuildinFileSystemParameters();
			var initParameters = new OfflinePlayModeParameters();
			initParameters.BuildinFileSystemParameters = buildinFileSystem;
			await _defaultPackage.InitializeAsync(initParameters);
			await RequestPackageVersion();
			await UpdatePackageManifest();
			initFinishCallBack?.Invoke();
			UniLogger.Log("OfflineAssetSystem Init Success");
		}
	}
}